package org.darcy.controller.sys;

import org.darcy.entity.sys.SysLog;
import org.darcy.framework.model.PageData;
import org.darcy.framework.model.PageParam;
import org.darcy.framework.model.R;
import org.darcy.service.sys.SysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;

@Tag(name = "SysLog接口")
@RestController
@RequestMapping(value = "/SysLog")
@Slf4j
public class SysLogController {

	private final String info_prefix = "[SysLog模块]";

	@Autowired
	private SysLogService sysLogService;

	// @Operation(summary="SysLog分页列表")
	@PostMapping(value = "list")
	public R list(@RequestBody PageParam param) {
		log.debug("{}-列表数据", info_prefix);
		PageData<SysLog> data = sysLogService.page(param);
		return R.ok().data(data);
	}

	@Operation(summary = "根据ID删除操作日志")
	@PostMapping("/del/{id}")
	public R del(@PathVariable String id) {
		log.debug("{}-根据ID删除", info_prefix, id);
		sysLogService.delete(id);
		return R.ok("删除成功");
	}

}
